<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  
  <script type="text/javascript">
    /*
      Fetch响应结果的数据格式
      {"uname":"zhangsan","age":23,"gender":"female"} 
    */
    fetch('http://localhost:8082/json_data').then(function(data) {
      return data.text();
    }).then(function(data) {
      console.log(typeof data); //string
      console.log(data);  //{"uname":"zhangsan","age":23,"gender":"female"}
      //转换为json对象
      const obj = JSON.parse(data);
      console.log(obj.uname,obj.age,obj.gender);
    })
  </script>
</body>
</html>